package gui;

import exceptions.RelationAlreadyInSetException;
import exceptions.RelationNotInSetException;

import javax.swing.*;
import javax.swing.event.ListSelectionListener;
import java.awt.event.ActionListener;

/**
 * Created by IntelliJ IDEA.
 * User: Jason
 * Date: 21/12/2011
 * Time: 12:53
 */
public class NeptuneWindow extends JFrame {

    private NeptuneContainerPanel topLevelContainer;

	public NeptuneWindow(){

        this.setSize(1024, 768);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        this.topLevelContainer = new NeptuneContainerPanel();

        this.getContentPane().add(topLevelContainer);



	}

    public void addRelationSelectionListeners(ListSelectionListener listSelectionListener) {
        topLevelContainer.addRelationSelectionListeners(listSelectionListener);
    }

    public void removeRelation() {
        topLevelContainer.removeRelation();
    }

    public void addRemoveRelationButtonListener(ActionListener removeRelationButtonListener) {

        topLevelContainer.addRemoveRelationButtonListener(removeRelationButtonListener);
    }

    public void addAddRelationButtonListener(ActionListener addRelationButtonListener) {
        topLevelContainer.addAddRelationButtonListener(addRelationButtonListener);
    }

    public void addRelation(String s) throws RelationAlreadyInSetException {
        topLevelContainer.addRelation(s);
    }

    public void renameRelation(String s, String s1) throws RelationNotInSetException, RelationAlreadyInSetException {
        topLevelContainer.renameRelation(s,s1);
    }

    public String getCurrentlySelectedRelation() {
       return topLevelContainer.getCurrentlySelectedRelation();
    }

    public void addRenameButtonListener(ActionListener renameRelationButtonListener) {
        topLevelContainer.addRenameRelationButtonListener(renameRelationButtonListener);
    }

    public void setSelectedRelation(String s) {
        topLevelContainer.setSelectedRelation(s);
    }

    public void addDBSpecButtonListener(ActionListener specDialog) {
        topLevelContainer.addDBSpecButtonListener(specDialog);
    }

    public void addEvaluateButtonListener(ActionListener evaluateButtonListener) {
        topLevelContainer.addEvaluateButtonListener(evaluateButtonListener);
    }
}
